/**
 * Created by Xiang on 2017/7/14
 * 小学题目列表
 */
import {BaseModel, Variables, variableToke} from './BaseModels';

export default {
  1: BaseModel({
    note: '形如0.75 * 3=?,两个数字位的小数，乘以一位整数',
    template: '$' + variableToke('a') + '\\times' + variableToke('b') + '= \\enspace ?$',
    variables: [{
      name: 'a',
      ...new Variables({
        type: 'numeric', range: [0.2, 1], fixed: 2, ratio: null,
        perturbation: (num) => Math.random() > 0.5 ? num : (num * 10).toFixed(1)
      })
    }, {
      name: 'b',
      ...new Variables({type: 'numeric', range: [1, 10], fixed: 0})
    }],
    answerTemplate: '',
    answerFunc(variables) {
      return variables[0].value * variables[1].value;
    },
    analyseTemplate: '',
    hintTemplates: [],
  }),
  2: BaseModel({
    note: '形如0.75 * 31=?,两个数字位的小数，乘以两位整数',
    template: '$' + variableToke('a') + '\\times' + variableToke('b') + '= \\enspace ?$',
    variables: [{
      name: 'a',
      ...new Variables({
        type: 'numeric', range: [0.2, 1], fixed: 2, ratio: null,
        perturbation: (num) => Math.random() > 0.5 ? num : (num * 10).toFixed(1)
      })
    }, {
      name: 'b',
      ...new Variables({type: 'numeric', range: [11, 40], fixed: 0})
    }],
    answerTemplate: '',
    answerFunc(variables) {
      return variables[0].value * variables[1].value;
    },
    analyseTemplate: '',
    hintTemplates: [],
  }),
  3: BaseModel({
    note: '形如0.75 * 3.1=?,两个数字位的小数两个数字位的小数',
    template: '$' + variableToke('a') + '\\times' + variableToke('b') + '= \\enspace ?$',
    variables: [{
      name: 'a',
      ...new Variables({
        type: 'numeric', range: [0.2, 1], fixed: 2, ratio: null,
        perturbation: (num) => Math.random() > 0.5 ? num : (num * 10).toFixed(1)
      })
    }, {
      name: 'b',
      ...new Variables({
        type: 'numeric', range: [0.2, 1], fixed: 2, ratio: null,
        perturbation: (num) => Math.random() > 0.5 ? num : (num * 10).toFixed(1)
      })
    }],
    answerTemplate: '',
    answerFunc(variables) {
      return variables[0].value * variables[1].value;
    },
    analyseTemplate: '',
    hintTemplates: [],
  })
};
